package com.wy.concurrent_sort;

import java.util.Arrays;

/**
 * @author 美女
 * @date 2022/04/21 14:43
 **/
public class SingleSort {
    //记录排序耗时

    public static void main(String[] args) throws InterruptedException {
        long[] array=ArrayHelper.generateArray(4_000_0000);
        //四个线程排，一个排一千万
        //分别是
        //[0,1000_0000)
        //[10000000,20000000)
        //[20000000,30000000)
        //[30000000,40000000)
        long start=System.currentTimeMillis();
        Arrays.sort(array,0,1000_0000);
        Arrays.sort(array,1000_0001,2000_0000);
        Arrays.sort(array,2000_0001,3000_0000);
        Arrays.sort(array,3000_0001,4000_0000);
        long end=System.currentTimeMillis();
        long elapsed=end-start;//总共耗时时间
        System.out.println(elapsed);
    }
}
